﻿using DataScripter.Excel.Formulas;

namespace DataScripter.Excel.Functions
{
	class If : Formula
	{
		public Formula IfClause { get; set; }
		public Formula TrueClause { get; set; }
		public Formula FalseClause { get; set; }

		public If(Formula ifClause, Formula trueClause, Formula falseClause)
		{
			IfClause = ifClause;
			TrueClause = trueClause;
			FalseClause = falseClause;
		}
		#region Overrides of Formula

		public override string Resolve(ICell current)
		{
			return string.Format(DutchFunctionNames.IF + "({0};{1};{2})", IfClause.Resolve(current), TrueClause.Resolve(current), FalseClause.Resolve(current));
		}

		#endregion

	}
}
